package com.yx.front.controller;


import com.yx.front.config.global.CommonResult;
import com.yx.front.manager.AuditRelationManager;
import com.yx.front.model.param.AuditRelationParam;
import com.yx.front.model.vo.FriendApplyVo;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 关系审核表 前端控制器
 * </p>
 *
 * @author YangXiong
 * @since 2023-04-20
 */
@Slf4j
@RestController
@RequestMapping("/audit-relation")
public class AuditRelationController {
    @Resource
    private AuditRelationManager auditRelationManager;

    @PostMapping("/audit")
    @ApiOperation("审核一条记录")
    public CommonResult<String> audit(@RequestBody AuditRelationParam param) {
        String result = auditRelationManager.audit(param);
        return CommonResult.success(result);
    }

    @GetMapping("/list")
    @ApiOperation("查询当前用户好友申请列表")
    public CommonResult<List<FriendApplyVo>> getApplyList() {
        return auditRelationManager.getApplyList();
    }

    @GetMapping("/apply")
    @ApiOperation("个人已申请列表")
    public CommonResult<List<FriendApplyVo>> getMyApply(){
        return auditRelationManager.getMyApply();
    }

}

